function out = showDataFromList(data, parameter)
% showDataFromList
%
% data -- structure -- cell data, from loadDataFromList.m
% parameter -- string -- field name in data
%
% TODO: important -- need to make it work for empty vectors

% gs jan 2008
% --------------------------------
disp(' ')
if nargin == 0
    disp('showDataFromList: provide a parameter name.');
    return
end

param = [];
for n = 1 : data.numCells;
    if isfield(data.cellData{n}, parameter)
        eval(['p = data.cellData{n}.' parameter ';'])
        if ~isempty(p)
            if isnumeric(p)
                if isscalar(p) % works for scalars
                    param(n) = p; %#ok<AGROW>
                else % not yet working for vectors, arrays
                end
                disp([num2str(n) '  ' data.cellData{n}.experiment '  ' ...
                    num2str(p)]);

            elseif ischar(p)
                disp([num2str(n) '  ' data.cellData{n}.experiment '  ' p]);
            end
        else
            disp([num2str(n) '  ' data.cellData{n}.experiment '  ' p]);
        end
    else
        param(n) = NaN; %#ok<AGROW>
        disp([num2str(n) '  ' data.cellData{n}.experiment '  -- field missing']);
    end
end
out = param;
